﻿<Window x:Class="StackHash.OptionsWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vcs="clr-namespace:StackHash.ValueConverters"
    xmlns:local="clr-namespace:StackHash"
    Title="Client Options - StackHash" Width="400" MinWidth="400" Height="450" MinHeight="450" Icon="/StackHash;component/StackHash.ico" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" Loaded="Window_Loaded" Closed="Window_Closed" ResizeMode="CanResize">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="MasterResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Window.CommandBindings>
        <CommandBinding Command="Help" x:Name="commandBindingHelp" Executed="commandBindingHelp_Executed" />
    </Window.CommandBindings>
    <Grid Name="gridMain">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <TabControl Margin="10" Name="tabControl">
            <TabItem Header="Service Connection" Name="tabItemServiceConnection">
                <AdornerDecorator>
                    <Grid Margin="3">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <TextBlock Margin="5,5,5,12" Grid.ColumnSpan="3" TextWrapping="Wrap">Enter the host and port of your StackHash Service and choose a profile to work with. To add or edit a profile click Service Options below.</TextBlock>
                    
                        <Label Grid.Row="1" Target="{Binding ElementName=textBoxServiceHost}">_Host:</Label>
                        <TextBox Margin="3" Grid.Row="1" Grid.Column="1" Name="textBoxServiceHost" Text="{Binding ServiceHost, ValidatesOnDataErrors=True, Mode=TwoWay}" ToolTip="{Binding ElementName=textBoxServiceHost, Path=(Validation.Errors)[0].ErrorContent}" TextChanged="textBoxServiceHost_TextChanged" />

                        <Label Grid.Row="2" Target="{Binding ElementName=textBoxServicePort}">_Port:</Label>
                        <TextBox Margin="3" Grid.Row="2" Grid.Column="1" Name="textBoxServicePort" Text="{Binding ServicePort, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, Mode=TwoWay}" ToolTip="{Binding ElementName=textBoxServicePort, Path=(Validation.Errors)[0].ErrorContent}" TextChanged="textBoxServicePort_TextChanged" />

                        <Label Grid.Row="3" Target="{Binding ElementName=comboBoxProfiles}">P_rofile:</Label>
                        <ComboBox Margin="3" Grid.Row="3" Grid.Column="1" Name="comboBoxProfiles" DisplayMemberPath="ProfileName" SelectionChanged="comboBoxProfiles_SelectionChanged" ToolTip="Click to choose a profile. If no profiles are available click Service Options to add one." />
                        <Button Grid.Row="3" Grid.Column="2" Margin="3" Name="buttonRefreshProfiles" Click="buttonRefreshProfiles_Click">Re_fresh</Button>
                        
                        <TextBlock Grid.Row="4" Grid.Column="1" Margin="3">
                            <Hyperlink Name="hyperlinkCredentials" Click="hyperlinkCredentials_Click">Service Credentials</Hyperlink>
                        </TextBlock>

                        <CheckBox Margin="5,3,3,3" Grid.Row="5" Grid.ColumnSpan="3" VerticalAlignment="Bottom" IsChecked="{Binding DiagnosticLogEnabled, Mode=TwoWay}">_Write client diagnostic log to Desktop</CheckBox>

                    </Grid>
                </AdornerDecorator>
            </TabItem>

            <TabItem Header="Debuggers"  Name="tabItemDebuggers">
                <AdornerDecorator>
                    <Grid Margin="3">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <TextBlock Margin="5,3,5,3" Grid.ColumnSpan="3" FontWeight="Bold">Debugging tools for Windows (WinDbg.exe):</TextBlock>
                    
                        <Label Grid.Row="1" Target="{Binding ElementName=textBoxDebuggerX86}">_32-bit Debugger:</Label>
                        <TextBox Margin="3" Grid.Row="1" Grid.Column="1" Name="textBoxDebuggerX86" Text="{Binding DebuggerPathX86, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, Mode=TwoWay}" ToolTip="{Binding ElementName=textBoxDebuggerX86, Path=(Validation.Errors)[0].ErrorContent}" />
                        <Button Margin="3" Grid.Row="1" Grid.Column="2" Name="buttonBrowseX86" Click="buttonBrowseX86_Click">_Browse...</Button>

                        <Label Grid.Row="2" Target="{Binding ElementName=textBoxDebuggerAmd64}" Name="labelDebuggerAmd64">_64-bit Debugger:</Label>
                        <TextBox Margin="3" Grid.Row="2" Grid.Column="1" Name="textBoxDebuggerAmd64" Text="{Binding DebuggerPathAmd64, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, Mode=TwoWay}" ToolTip="{Binding ElementName=textBoxDebuggerAmd64, Path=(Validation.Errors)[0].ErrorContent}" />
                        <Button Margin="3" Grid.Row="2" Grid.Column="2" Name="buttonBrowseAmd64" Click="buttonBrowseAmd64_Click">B_rowse...</Button>

                        <TextBlock Margin="5,13,5,3" Grid.Row="3" Grid.ColumnSpan="3" FontWeight="Bold">Visual Studio (devenv.exe):</TextBlock>

                        <Label Grid.Row="4" Target="{Binding ElementName=textBoxDebuggerVisualStudio}" Name="labelDebuggerVisualStudio">_Visual Studio:</Label>
                        <TextBox Margin="3" Grid.Row="4" Grid.Column="1" Name="textBoxDebuggerVisualStudio" Text="{Binding DebuggerPathVisualStudio, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, Mode=TwoWay}" ToolTip="{Binding ElementName=textBoxDebuggerVisualStudio, Path=(Validation.Errors)[0].ErrorContent}" />
                        <Button Margin="3" Grid.Row="4" Grid.Column="2" Name="buttonBrowseVisualStudio" Click="buttonBrowseVisualStudio_Click">Br_owse...</Button>

                        <TextBlock Margin="5,13,5,3" Grid.Row="5" Grid.ColumnSpan="3" FontWeight="Bold">Default (F5) Debugger:</TextBlock>
                    
                        <Label Grid.Row="6">_Default:</Label>
                        <ComboBox Margin="3" Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" ItemsSource="{Binding Debuggers}" SelectedItem="{Binding SelectedDebugger, Mode=TwoWay}" DisplayMemberPath="DebuggerName" />

                    </Grid>
                </AdornerDecorator>
            </TabItem>
            
            <TabItem Header="Display Filter" Name="tabItemDefaultDisplayFilter">
                <AdornerDecorator>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBlock Margin="5,5,5,12" TextWrapping="Wrap">The default display filter prevents low hit count events from being shown in the client. This filter can be overridden for each product.</TextBlock>
                        <local:DisplayPolicyControl Grid.Row="1" x:Name="displayPolicyControl" />
                    </Grid>
                </AdornerDecorator>
            </TabItem>

            <TabItem Header="Proxy Server" Name="tabItemProxyServer">
                <AdornerDecorator>
                    <Grid Margin="3">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <TextBlock Margin="5,5,5,12" TextWrapping="Wrap">Enter proxy server settings for this computer below. To configure a proxy server for the StackHash Service click Service Options.</TextBlock>

                        <local:ProxySettingsControl Grid.Row="1" x:Name="proxySettingsControl" />
                    
                    </Grid>
                </AdornerDecorator>
            </TabItem>
            
            <TabItem Header="Advanced" Name="tabItemAdvanced">
                <AdornerDecorator>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Label Target="{Binding ElementName=textBoxEventsPerPage}">_Events Per Page:</Label>
                        <TextBox Margin="3" Grid.Column="1" Name="textBoxEventsPerPage" Text="{Binding EventsPerPage, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, Mode=TwoWay}" ToolTip="{Binding ElementName=textBoxEventsPerPage, Path=(Validation.Errors)[0].ErrorContent}" />
                        
                        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Margin="3"><Hyperlink Name="linkResetMessages" Click="linkResetMessages_Click">Reset hidden messages</Hyperlink></TextBlock>

                    </Grid>
                </AdornerDecorator>
            </TabItem>

        </TabControl>

        <Border Grid.Row="1" Style="{StaticResource ButtonBorder}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                
                <Button Margin="10" Command="Help">_Help</Button>

                <StackPanel Grid.Column="1" Margin="7" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                    <Button Margin="3" Width="110" Name="buttonManageProfiles" Click="buttonManageProfiles_Click">_Service Options...</Button>
                    <Button Margin="3" Name="buttonOK" IsDefault="True" Click="buttonOK_Click">OK</Button>
                    <Button Margin="3" IsCancel="True" Name="buttonCancel" Click="buttonCancel_Click">Cancel</Button>
                </StackPanel>

            </Grid>
        </Border>
        
    </Grid>
</Window>
